﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCEntity.TMS.Driver.DriverExamine;

namespace BCData.TMS.Driver.DriverExamine
{
    /// <summary>
    /// 司机考试试卷信息
    /// </summary>
    public interface IDriverExaminePaperData
    {
        /// <summary>
        /// 新增考试试卷
        /// </summary>
        /// <param name="entity">考试试卷信息</param>
        /// <returns></returns>
        Task<DriverExaminePaperEntity> InsertAsync(DriverExaminePaperEntity entity);
        /// <summary>
        /// 修改考试试卷
        /// </summary>
        /// <param name="entity">试卷信息</param>
        /// <returns></returns>
        Task<DriverExaminePaperEntity> UpdateAsync(DriverExaminePaperEntity entity);
        /// <summary>
        /// 删除考试试卷
        /// </summary>
        /// <param name="paperId">试卷Id</param>
        /// <returns></returns>
        Task<bool> DeleteAsync(int paperId);

        /// <summary>
        /// 获取考试试卷
        /// </summary>
        /// <param name="paperId">试卷Id</param>
        /// <returns></returns>
        Task<DriverExaminePaperEntity> GetExaminePaperByIdAsync(int paperId);
        /// <summary>
        /// 分页获取考试试卷信息
        /// </summary>
        /// <param name="pageIndex">分页页码</param>
        /// <param name="pageSize">分页页数</param>
        /// <returns></returns>
        Task<(IEnumerable<DriverExaminePaperEntity>, int)> GetDriverExaminePapersAsync(int pageIndex, int pageSize);
        /// <summary>
        /// 检查试卷信息是否存在
        /// </summary>
        /// <param name="paperId">试卷Id</param>
        /// <returns></returns>
        Task<bool> CheckExistsByIdAsync(long paperId);
        /// <summary>
        /// 检查试卷信息是否存在
        /// </summary>
        /// <param name="correctAmount">正确答案</param>
        /// <param name="errorAmount">错误答案</param>
        /// <returns></returns>
        Task<DriverExaminePaperEntity> CheckExistsByAmountsAsync(int correctAmount, int errorAmount);
        /// <summary>
        /// 更新答题完成时间
        /// </summary>
        /// <param name="paperId">试卷Id</param>
        /// <returns></returns>
        Task<DriverExaminePaperEntity> UpdateEndTimeAsync(long paperId);
    }
}
